-- so much crap
local t = Def.ActorFrame{
	-- P1
	Def.Sprite{
		InitCommand=cmd(x,(SCREEN_CENTER_X*0.575)-49;y,SCREEN_BOTTOM-35);
		OnCommand=cmd(playcommand,"Refresh");
		CoinInsertedMessageCommand=cmd(playcommand,"Refresh");
		CoinModeChangedMessageCommand=cmd(playcommand,"Refresh");
		RefreshCommand=function(self)
			local p1join = GAMESTATE:IsHumanPlayer(PLAYER_1);
			if p1join then
				self:finishtweening();
				self:Load(THEME:GetPathG("","Statusbar/p1at"));
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			else
				self:finishtweening();
				self:Load(THEME:GetPathG("","Statusbar/p1ab"));
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			end;
		end;
		PlayerJoinedMessageCommand=function(self,param)
			if param.Player == PLAYER_1 then
				self:finishtweening();
				self:Load(THEME:GetPathG("","Statusbar/p1at"));
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			end;
		end;
	};

	LoadActor(THEME:GetPathG("","Statusbar/joinup"))..{
		InitCommand=cmd(x,(SCREEN_CENTER_X*0.575)+10;y,SCREEN_BOTTOM-44);
		OnCommand=cmd(playcommand,"Refresh");
		CoinInsertedMessageCommand=cmd(playcommand,"Refresh");
		CoinModeChangedMessageCommand=cmd(playcommand,"Refresh");
		RefreshCommand=function(self)
			local p1join = GAMESTATE:IsHumanPlayer(PLAYER_1);
			if p1join then
				self:finishtweening();
				self:visible(false);
			else
				self:finishtweening();
				self:visible(true);
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			end;
		end;
		PlayerJoinedMessageCommand=function(self,param)
			if param.Player == PLAYER_1 then
				self:finishtweening();
				self:visible(false);
			end;
		end;
	};

	Def.ActorFrame{
		InitCommand=cmd(playcommand,"CheckNumPlayers");
		CheckNumPlayersCommand=function(self)
			if GAMESTATE:GetNumPlayersEnabled() > 1 then
				self:visible(false);
			else
				self:visible(true);
			end;
		end;

		LoadFont("_shared2")..{
			InitCommand=cmd(x,(SCREEN_CENTER_X*0.575)+10;y,SCREEN_BOTTOM-44;zoom,0.6;maxwidth,260);
			Text="TESTING";
			OnCommand=cmd(playcommand,"Refresh");
			CoinInsertedMessageCommand=cmd(playcommand,"Refresh");
			CoinModeChangedMessageCommand=cmd(playcommand,"Refresh");
			RefreshCommand=function(self)
				local bCanPlay = GAMESTATE:EnoughCreditsToJoin();
				local p1join = GAMESTATE:IsHumanPlayer(PLAYER_1);
				local p2join = GAMESTATE:IsHumanPlayer(PLAYER_2);
				if bCanPlay and p2join then
					self:finishtweening();
					self:visible(true);
					self:settext(THEME:GetString("ScreenTitleJoin","HelpTextJoin"));
					self:zoomy(0);
					self:linear(0.3);
					self:zoomy(0.6);
					self:diffuseshift();
					self:effectperiod(0.4);
					self:effectcolor1(color("1,0.6,0.9,1"));
					self:effectcolor2(color("1,0.3,0.4,1"));
				elseif p1join then
					self:finishtweening();
					self:visible(false);
				else
					self:finishtweening();
					self:visible(true);
					self:settext(THEME:GetString("ScreenTitleJoin","HelpTextWait"));
					self:zoomy(0);
					self:linear(0.3);
					self:zoomy(0.6);
					self:diffuseshift();
					self:effectperiod(0.4);
					self:effectcolor1(color("1,0.6,0.9,1"));
					self:effectcolor2(color("1,0.3,0.4,1"));
				end;
			end;
			PlayerJoinedMessageCommand=function(self,param)
				if param.Player == PLAYER_1 then
					self:finishtweening();
					self:visible(false);
				end;
			end;
		};
	};

	-- P2
	Def.Sprite{
		InitCommand=cmd(x,(SCREEN_CENTER_X*1.425)+49;y,SCREEN_BOTTOM-35);
		OnCommand=cmd(playcommand,"Refresh");
		CoinInsertedMessageCommand=cmd(playcommand,"Refresh");
		CoinModeChangedMessageCommand=cmd(playcommand,"Refresh");
		RefreshCommand=function(self)
			local p2join = GAMESTATE:IsHumanPlayer(PLAYER_2);
			if p2join then
				self:finishtweening();
				self:Load(THEME:GetPathG("","Statusbar/p2at"));
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			else
				self:finishtweening();
				self:Load(THEME:GetPathG("","Statusbar/p2ab"));
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			end;
		end;
		PlayerJoinedMessageCommand=function(self,param)
			if param.Player == PLAYER_2 then
				self:finishtweening();
				self:Load(THEME:GetPathG("","Statusbar/p2at"));
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			end;
		end;
	};
	
	LoadActor(THEME:GetPathG("","Statusbar/joinup"))..{
		InitCommand=cmd(x,(SCREEN_CENTER_X*1.425)-10;y,SCREEN_BOTTOM-44;rotationy,180);
		OnCommand=cmd(playcommand,"Refresh");
		CoinInsertedMessageCommand=cmd(playcommand,"Refresh");
		CoinModeChangedMessageCommand=cmd(playcommand,"Refresh");
		RefreshCommand=function(self)
			local p2join = GAMESTATE:IsHumanPlayer(PLAYER_2);
			if p2join then
				self:finishtweening();
				self:visible(false);
			else
				self:finishtweening();
				self:visible(true);
				self:zoomy(0);
				self:linear(0.3);
				self:zoomy(1);
			end;
		end;
		PlayerJoinedMessageCommand=function(self,param)
			if param.Player == PLAYER_2 then
				self:visible(false);
			end;
		end;
	};

	Def.ActorFrame{
		InitCommand=cmd(playcommand,"CheckNumPlayers");
		CheckNumPlayersCommand=function(self)
			if GAMESTATE:GetNumPlayersEnabled() > 1 then
				self:visible(false);
			else
				self:visible(true);
			end;
		end;

		LoadFont("_shared2")..{
			InitCommand=cmd(x,(SCREEN_CENTER_X*1.425)-10;y,SCREEN_BOTTOM-44;zoom,0.6;maxwidth,260);
			Text="TESTING";
			OnCommand=cmd(playcommand,"Refresh");
			CoinInsertedMessageCommand=cmd(playcommand,"Refresh");
			CoinModeChangedMessageCommand=cmd(playcommand,"Refresh");
			RefreshCommand=function(self)
				local bCanPlay = GAMESTATE:EnoughCreditsToJoin();
				local p1join = GAMESTATE:IsHumanPlayer(PLAYER_1);
				local p2join = GAMESTATE:IsHumanPlayer(PLAYER_2);
				if bCanPlay and p1join then
					self:finishtweening();
					self:visible(true);
					self:settext(THEME:GetString("ScreenTitleJoin","HelpTextJoin"));
					self:zoomy(0);
					self:linear(0.3);
					self:zoomy(0.6);
					self:diffuseshift();
					self:effectperiod(0.4);
					self:effectcolor1(color("1,0.6,0.9,1"));
					self:effectcolor2(color("1,0.3,0.4,1"));
				elseif p2join then
					self:finishtweening();
					self:visible(false);
				else
					self:finishtweening();
					self:visible(true);
					self:settext(THEME:GetString("ScreenTitleJoin","HelpTextWait"));
					self:zoomy(0);
					self:linear(0.3);
					self:zoomy(0.6);
					self:diffuseshift();
					self:effectperiod(0.4);
					self:effectcolor1(color("1,0.6,0.9,1"));
					self:effectcolor2(color("1,0.3,0.4,1"));
				end;
			end;
			PlayerJoinedMessageCommand=function(self,param)
				if param.Player == PLAYER_2 then
					self:finishtweening();
					self:visible(false);
				end;
			end;
		};
	};
};

return t;